# all:
# 	g++ -O2 -m64 -Wall -DLINUX ./PPCS_Client.cpp -L ../lib/ -o PPCS_Client -s -lpthread -lPPCS_API -Wl,-rpath=./
# 	g++ -O2 -m64 -Wall -DLINUX ./PPCS_Device.cpp -L ../lib/ -o PPCS_Device -s -lpthread -lPPCS_API -Wl,-rpath=./
#
# clean:
# 	rm -rf *.o *~ *.bak PPCS_Client PPCS_Device

# 规范用法：
# LDFLAGS 是告诉链接器从哪里寻找库文件
# LIBS 是告诉链接器要链接哪些库文件
LIBS=-lpthread -lPPCS_API
LDFLAGS=-I ../include/ -L ../lib/ -Wl,-rpath,.
# CFLAGS=-O2 -s -Wall
CFLAGS=-g -Wall

OBJS_OTHERS=utils.o
OBJS_MPROXY_DEVICE=mproxy_device.o
OBJS_MPROXY_CLIENT=mproxy_client.o
MPROXY_DEVICE=mproxy_device
MPROXY_CLIENT=mproxy_client

all:$(MPROXY_DEVICE) $(MPROXY_CLIENT)

$(MPROXY_DEVICE):$(OBJS_MPROXY_DEVICE) $(OBJS_OTHERS)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LIBS)

$(MPROXY_CLIENT):$(OBJS_MPROXY_CLIENT) $(OBJS_OTHERS)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LIBS)

.PHONY:clean
clean:
	-rm $(MPROXY_DEVICE) $(MPROXY_CLIENT)
	-rm $(OBJS_MPROXY_DEVICE) $(OBJS_MPROXY_CLIENT) $(OBJS_OTHERS)
